<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Data Driven Substructure: covariance.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Data Driven Substructure
   
   </div>
   <div id="projectbrief">A library for carrying out Multivariate Kernel Smoothing--designed to be fast and flexible for large data processing.</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">covariance.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef __COVARIANCE__</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define __COVARIANCE__</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;valarray&gt;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="keyword">using namespace </span>std;
<a name="l00009"></a>00009 
<a name="l00018"></a><a class="code" href="classCovariance.html">00018</a> <span class="keyword">class </span><a class="code" href="classCovariance.html" title="class for Covariance matrix">Covariance</a>
<a name="l00019"></a>00019 {
<a name="l00020"></a>00020  <span class="keyword">public</span>:
<a name="l00021"></a>00021 
<a name="l00022"></a>00022   valarray&lt;double&gt; bandwidth; 
<a name="l00025"></a>00025 
<a name="l00026"></a>00026   valarray&lt;double&gt; bandwidth_inverse; 
<a name="l00030"></a>00030 
<a name="l00031"></a>00031   
<a name="l00032"></a>00032   <a class="code" href="classCovariance.html" title="class for Covariance matrix">Covariance</a>(<span class="keywordtype">int</span> rank_=1);
<a name="l00034"></a>00034  
<a name="l00035"></a><a class="code" href="classCovariance.html#a8b84948da6b3975d2ff5b0b0407b5479">00035</a>   <span class="keywordtype">int</span> Rank()<span class="keyword"> const</span>
<a name="l00036"></a>00036 <span class="keyword">  </span>{<span class="keywordflow">return</span> rank;}
<a name="l00038"></a>00038 
<a name="l00039"></a>00039   <span class="keywordtype">void</span> ComputeBandwidth(<span class="keywordtype">double</span> min_size=-1.0, <span class="keywordtype">double</span> extra_factor=1.0);
<a name="l00043"></a>00043 
<a name="l00044"></a>00044   <span class="keywordtype">double</span> BandwidthNorm(<span class="keyword">const</span> valarray&lt;double&gt;&amp; band, <span class="keywordtype">int</span> power=-1);
<a name="l00047"></a>00047 
<a name="l00048"></a>00048   <span class="keywordtype">double</span> Correlation(<span class="keywordtype">int</span> row, <span class="keywordtype">int</span> col) <span class="keyword">const</span>;
<a name="l00050"></a>00050 
<a name="l00051"></a>00051   <span class="keywordtype">double</span> operator()(<span class="keywordtype">int</span> row, <span class="keywordtype">int</span> col) <span class="keyword">const</span>;
<a name="l00054"></a>00054 
<a name="l00055"></a>00055   <span class="keywordtype">void</span> Fill(<span class="keyword">const</span> valarray&lt;double&gt;&amp; ntuple, <span class="keywordtype">double</span> weight=1.0);
<a name="l00058"></a>00058   
<a name="l00059"></a>00059   <span class="keyword">friend</span> ostream&amp; operator&lt;&lt;(ostream&amp;, <span class="keyword">const</span> <a class="code" href="classCovariance.html" title="class for Covariance matrix">Covariance</a>&amp;);
<a name="l00061"></a>00061 
<a name="l00062"></a>00062   <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classDataSet.html" title="a class to store multi-dimensional data">DataSet</a>;
<a name="l00063"></a>00063 
<a name="l00064"></a>00064  <span class="keyword">private</span>:
<a name="l00065"></a>00065   valarray&lt;double&gt; ary2; 
<a name="l00069"></a>00069 
<a name="l00070"></a>00070   valarray&lt;double&gt; ary;
<a name="l00072"></a>00072 
<a name="l00073"></a>00073   <span class="keywordtype">bool</span> compute_bandwidth;
<a name="l00075"></a>00075   
<a name="l00076"></a><a class="code" href="classCovariance.html#a19e0d1afb0808d61305b60b4f418ee47">00076</a>   <span class="keywordtype">int</span> <a class="code" href="classCovariance.html#a19e0d1afb0808d61305b60b4f418ee47" title="rank of matrix (not the same as tensor rank)">rank</a>; 
<a name="l00077"></a><a class="code" href="classCovariance.html#a153d50863ab5337b6acb6354bd96a1cf">00077</a>   <span class="keywordtype">double</span> <a class="code" href="classCovariance.html#a153d50863ab5337b6acb6354bd96a1cf" title="sum of weights or number of entries in covariance matrix">sum</a>; 
<a name="l00078"></a><a class="code" href="classCovariance.html#aca14b94adb91498ed1e98280526091af">00078</a>   <span class="keywordtype">double</span> sum2; 
<a name="l00079"></a>00079 
<a name="l00080"></a>00080 
<a name="l00081"></a>00081 };
<a name="l00082"></a>00082 
<a name="l00083"></a>00083 
<a name="l00084"></a>00084 
<a name="l00085"></a>00085 <span class="preprocessor">#endif</span>
</pre></div></div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Thu Sep 12 2013 17:12:58 for Data Driven Substructure by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
